package com.ys.controller.web.administration;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import com.bo.vo.W;
import com.ys.entity.administration.AdmSignetManage;
import com.ys.service.sys.CommonApiService;

@Controller
@RequestMapping("/web/administration/webAdmSignetManageController")
public class WebAdmSignetManageController {
	private static final Logger logger = LoggerFactory.getLogger(WebAdmSignetManageController.class);

	public static Long MENU_ID = 10165L;

	@Autowired
	private CommonApiService<AdmSignetManage> commonService;


	/*
	 * 新增
	 */
	@RequiresPermissions("admSignetManage:add")
	@GetMapping("/toAdd")
	public String toAdd(Model model, HttpServletRequest request, HttpServletResponse response){

		AdmSignetManage entity = new AdmSignetManage();
		//String code = "GS" + BidUtil.parseIntToFourLen(Integer.parseInt(entityMax.getVGsBm().replace("GS", "")) + 1);
		try {
			//String bid = commonService.getCommonNextBid(MENU_ID);
			entity.setSignetStatus(1);
			entity.setSignetType(null);
			return commonService.toAdd(model, entity, MENU_ID, null, null);
		} catch (Exception e) {
			logger.error("印章管理表新增页面出错：",e.getMessage(),e);
			return W.error(model, e.getMessage());
		}
	}

	/*
	 * 编辑
	 */
	@GetMapping("/toEdit")
	public String toEdit(Model model, HttpServletRequest request, HttpServletResponse response,
			Long id){

		try {
			return commonService.toEdit(model, id, new AdmSignetManage(), MENU_ID, null, null);
		} catch (Exception e) {
			logger.error("印章管理表编辑页面出错：",e.getMessage(),e);
			return W.error(model, e.getMessage());
		}
	}




}



